package com.zhyl.demo.service.impl;

import com.zhyl.demo.entity.InHospital;
import com.zhyl.demo.mapper.InHospitalMapper;
import com.zhyl.demo.service.InHospitalService;
import org.springframework.stereotype.Service;

/**
 * @author yang3
 */
@Service
public class InHospitalServiceImpl implements InHospitalService {
    private final InHospitalMapper inHospitalMapper;
    private InHospitalServiceImpl(InHospitalMapper inHospitalMapper)
    {
        this.inHospitalMapper = inHospitalMapper;
    }

    @Override
    public InHospital getInHospitalInfo(int id) {
        if (id<=0)
        {
            return null;
        }
        InHospital inHospitalInfo = inHospitalMapper.getInHospitalInfo(id);
        if (inHospitalInfo!=null)
        {
            return inHospitalInfo;
        }else {
            return null;
        }
    }

    @Override
    public Boolean addInHospital(InHospital inHospital) {
        if (inHospital==null){
            return false;
        }
        Integer integer = inHospitalMapper.addInHospital(inHospital);
        if (integer>0){
            return true;
        }else {
            return false;
        }
    }
}
